﻿
package extremefx.i18n {
	import extremefx.DateTime;
	import extremefx.i18n.EastAsianLunisolarCalendar;	
	/**
	 * @author Marcelo Volmaro
	 */
	public class ChineseLunisolarCalendar extends EastAsianLunisolarCalendar {
		private static const CHINESE_ERA:uint = 1;
		
		private static const MIN:DateTime = new DateTime (1901, 2, 19);
		private static const MAX:DateTime = new DateTime (2101, 1, 28, 23, 59, 59, 999);
		
		public function ChineseLunisolarCalendar() {
			super();
			_eraHandler.appendEra(CHINESE_ERA, CCFixed._fromDateTime(new DateTime(1, 1, 1)));
		}
		
		public override function get eras():Array {
			return _eraHandler.eras.concat();  
		}
		
		public override function getEra(pDate:DateTime):int {
			var rd:int = CCFixed._fromDateTime(pDate);
			var era:Array = [];
			_eraHandler.eraYear(era, rd);
			return int(era[0]);
		}
		
		public override function get minSupportedDateTime():DateTime {
			return MIN;
		}
		
		public override function get maxSupportedDateTime():DateTime {
			return MAX;
		}
	}
}
